package com.ty.day3;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/16 15:30
 */
public class Person {
    public static final Integer MAX_AGE = 100;
    public static final Integer MIN_AGE = 0;
    private String name;
    private Integer age;
    private String sex;
    private static int count = 0;

    public Person() {
        count++;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public void eat() {
        System.out.println(name + "喜欢吃炸鸡");
    }

    public void sleep() {
        System.out.println(name + "喜欢睡觉");
    }

    public void study() {
        System.out.println(name + "喜欢学Java");
    }

    public static void peopleCount() {
        System.out.println(count + "个人");
    }


    public void printPerson() {
        System.out.println(name + "性别：" + sex + "今年" + age + "岁");
    }

    public final boolean isPersonAge() {
        if (this.age < MIN_AGE || this.age > MAX_AGE) return false;
        else return true;
    }
}

class Test1 {
    public static void main(String[] args) {
        Person person = new Person();
        person.setName("王吉吉");
        person.setSex("男");
        person.setAge(23);
        person.sleep();
        person.study();
        person.eat();
        person.printPerson();
        if (person.isPersonAge()){
            System.out.println("年龄符合");
            System.out.println(Person.MAX_AGE);
            System.out.println(Person.MIN_AGE);
        }
    }
}
